package xorg.tools.mybatis.generate;

import org.mybatis.generator.api.IntrospectedTable;
import org.mybatis.generator.api.PluginAdapter;
import org.mybatis.generator.api.dom.java.FullyQualifiedJavaType;
import org.mybatis.generator.api.dom.java.Interface;
import org.mybatis.generator.api.dom.java.TopLevelClass;

import java.util.List;

/**
 * Created by iscdw on 2016/4/24.
 */
public class AnnotationPlugin extends PluginAdapter {

    private FullyQualifiedJavaType repository = new FullyQualifiedJavaType("org.springframework.stereotype.Repository");

    public boolean validate(List<String> list) {
        return true;
    }

    public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) {
        interfaze.addImportedType(this.repository);
        interfaze.addAnnotation("@Repository");
        return true;
    }
}
